cbuffer cbPerChar
{
    float4x4 TransformMatrix;
};

cbuffer cbPerText
{
    float3 Color;
};

struct VS_IN
{
    float2 Vertex : POSITION;
    float2 TexCoord : TEXCOORD;
};

struct VS_OUT
{
    float2 TexCoord : TEXCOORD;
    float4 Position : SV_POSITION;
};

SamplerState gTextTextureSamp
{
    Filter = MIN_MAG_MIP_POINT;
    AddressU = CLAMP;
    AddressV = CLAMP;
};

Texture2D TextTexture;

VS_OUT VS(VS_IN vIn)
{
    VS_OUT vOut;
    vOut.Position = mul(float4(vIn.Vertex, 0.0, 1.0), TransformMatrix);
    vOut.TexCoord = vIn.TexCoord;
    return vOut;
}

float4 PS(VS_OUT pIn) : SV_Target
{
    return float4(Color, TextTexture.Sample(gTextTextureSamp, pIn.TexCoord).x);
}

technique10 TextRendering
{
    pass P0
    {
        SetVertexShader(CompileShader(vs_4_0, VS()));
        SetGeometryShader(NULL);
        SetPixelShader(CompileShader(ps_4_0, PS()));
    }
}